﻿namespace MetroTemplate.Model
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using MetroTemplate.Model.Interfaces;

    public class FacturesModel : IBaseClass
    {

        private long _FactureId;
        private string _Libelle;
        private string _Title;
        private string _Telephone;
        private DateTime _DateFacture;
        private string _Informations;
        private string _Remarques;
        private ObservableCollection<ArticleModel> _Articles 
            =  new ObservableCollection<ArticleModel>();

        public long FactureId
        {
            get
            {
                return _FactureId;
            }
            set
            {
                if (_FactureId == value)
                    return;
                _FactureId = value;
                RaiseChangedEvent("FactureId");
            }
        }
        public string Libelle
        {
            get
            {
                return _Libelle;
            }
            set
            {
                if (_Libelle == value)
                    return;
                _Libelle = value;
                RaiseChangedEvent("Libelle");
            }
        }
        public string Title
        {
            get
            {
                return _Title;
            }
            set
            {
                if (_Title == value)
                    return;
                _Title = value;
                RaiseChangedEvent("Title");
            }
        }
        public string Telephone
        {
            get
            {
                return _Telephone;
            }
            set
            {
                if (_Telephone == value)
                    return;
                _Telephone = value;
                RaiseChangedEvent("Telephone");
            }
        }
        public DateTime DateFacture
        {
            get
            {
                return _DateFacture;
            }
            set
            {
                if (_DateFacture == value)
                    return;
                _DateFacture = value;
                RaiseChangedEvent("DateFacture");
            }
        }
        public string Informations
        {
            get
            {
                return _Informations;
            }
            set
            {
                if (_Informations == value)
                    return;
                _Informations = value;
                RaiseChangedEvent("Informations");
            }
        }

        public string Remarques
        {
            get
            {
                return _Remarques;
            }
            set
            {
                if (_Remarques == value)
                    return;
                _Remarques = value;
                RaiseChangedEvent("Remarques");
            }
        }

        public ObservableCollection<ArticleModel> Articles
        {
            get
            {
                return _Articles;
            }
            set
            {
                if (_Articles == value)
                    return;
                _Articles = value;
                RaiseChangedEvent("Articles");
            }
        }

        public void Dispose()
        {
            throw new NotImplementedException();
        }

        public object Clone()
        {
            throw new NotImplementedException();
        }

        #region Events
        /// <summary>
        /// Permet de déclancher l'évenement PropertyChanged
        /// </summary>
        /// <param name="paramname">Le nom de la propriété modifiée</param>
        private void RaiseChangedEvent(string paramname)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(paramname));
            }
        }

        /// <summary>
        /// Permet de déclanché l'évenement PropertyChanging
        /// </summary>
        /// <param name="paramname">Le nom de la propriété en cours de changement</param>
        private void RaiseChangingEvent(string paramname)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(null, new System.ComponentModel.PropertyChangingEventArgs(paramname));
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;
        #endregion
    }
}
